package com.lj.back.manage.scaffold.module.sys.DTO;

import com.lj.back.manage.scaffold.common.annotation.valid.EnumCheck;
import com.lj.back.manage.scaffold.common.valid.group.AddStrategy;
import com.lj.back.manage.scaffold.common.valid.group.UpdateStrategy;
import com.lj.back.manage.scaffold.module.sys.enums.MenuTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Set;

/**
 * 后台管理---菜单DO对象
 * @author lv
 * @version 1.0.0
 */
@Data
@ApiModel("后台菜单传输对象")
public class SysMenuDTO implements Serializable {

    @NotNull(message = "{menu.id.notnull}",groups = UpdateStrategy.class)
    @Null(message = "{menu.id.isnull}",groups = AddStrategy.class)
    @ApiModelProperty(value = "菜单ID", example = "1")
    private Long id;

    @NotNull(message = "{menu.name.notnull}",groups = AddStrategy.class)
    @Null(message = "{menu.name.isnull}",groups = UpdateStrategy.class)
    @ApiModelProperty(value = "菜单名称", example = "新增")
    private String name;

    @ApiModelProperty(value = "菜单地址", example = "/sys/manageMenu")
    private String url;

    @EnumCheck(enumClass = MenuTypeEnum.class)
    @NotNull(message = "{menu.type.notnull}",groups = AddStrategy.class)
    @Null(message = "{menu.type.isnull}",groups = UpdateStrategy.class)
    @ApiModelProperty(value = "菜单类型", example = "1")
    private String type;

    @ApiModelProperty(value = "菜单图片")
    private String icon;

    @NotNull(message = "{menu.order.notnull}",groups = AddStrategy.class)
    @ApiModelProperty(value = "菜单排序", example = "0")
    @Min(value = 0,message = "menu.order.min")
    private String order;

    @NotNull(message = "{menu.parentId.notnull}",groups = AddStrategy.class)
    @Null(message = "{menu.parentId.isnull}",groups = UpdateStrategy.class)
    @ApiModelProperty(value = "父菜单ID", example = "1")
    private Long parentId;

    @ApiModelProperty(value = "权限ID列表", example = "[1,2,3]")
    private Set<Long> permIds;

    @ApiModelProperty(value = "描述", example = "测试新增按钮")
    private String describe;

    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    private static final long serialVersionUID = 1L;
}
